.TH "DirectShowCapture" 3 "13 Oct 2009" "Version 2" "zebulon" \" -*- nroff -*-
.ad l
.nh
.SH NAME
DirectShowCapture \- 
.SH SYNOPSIS
.br
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBDirectShowCapture\fP ()"
.br
.RI "\fIConstructor. \fP"
.ti -1c
.RI "\fB~DirectShowCapture\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "int \fBStart\fP (const std::string &videoSource, const int width=0, const int height=0, const bool interlace=false)"
.br
.RI "\fIStart capture from a video source. \fP"
.ti -1c
.RI "int \fBStop\fP ()"
.br
.RI "\fIStops capture from video source. \fP"
.ti -1c
.RI "int \fBGetFrame\fP (\fBCvImageCapture::Image\fP *dest, const bool block=false)"
.br
.RI "\fIGet the next frame from the image source. \fP"
.ti -1c
.RI "bool \fBIsReady\fP () const "
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static unsigned int \fBScanForSources\fP (std::vector< std::string > &sources)"
.br
.RI "\fIGet a list of video sources connected to the computer (cameras). \fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "int \fBInitializeVideo\fP ()"
.br
.RI "\fIInitializes capture from a video source, (USB or Firewire DV Camera). \fP"
.ti -1c
.RI "int \fBInitializeFile\fP ()"
.br
.RI "\fIInitializes capture from a file video source. \fP"
.ti -1c
.RI "\fBSTDMETHODIMP_\fP (ULONG) AddRef()"
.br
.ti -1c
.RI "\fBSTDMETHODIMP_\fP (ULONG) Release()"
.br
.ti -1c
.RI "STDMETHODIMP \fBQueryInterface\fP (REFIID riid, void **ppv)"
.br
.RI "\fIThis function is part of the callbacks used by ISampleGrabberCB. \fP"
.ti -1c
.RI "virtual HRESULT STDMETHODCALLTYPE \fBSampleCB\fP (double sampleTime, IMediaSample *pSample)"
.br
.RI "\fIThis function is part of the callbacks used by ISampleGrabberCB. \fP"
.ti -1c
.RI "virtual HRESULT STDMETHODCALLTYPE \fBBufferCB\fP (double sampleTime, BYTE *pBuffer, long bufferLen)"
.br
.RI "\fIThe implemented callback function. Gets latest frame from the video feed. \fP"
.in -1c
.SS "Static Protected Member Functions"

.in +1c
.ti -1c
.RI "static HRESULT \fBGetVideoInputFilter\fP (IBaseFilter **gottaFilter, wchar_t *matchName)"
.br
.RI "\fIEnumerate all of the video input devices. \fP"
.ti -1c
.RI "static HRESULT \fBGetVideoInputFilter\fP (IBaseFilter **gottaFilter, const int num)"
.br
.RI "\fIEnumerate all of the video input devices. \fP"
.ti -1c
.RI "static HRESULT \fBGetPin\fP (IBaseFilter *pFilter, PIN_DIRECTION dirrequired, int iNum, IPin **ppPin)"
.br
.RI "\fIGet a pin in the the graph. \fP"
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "IMediaControl * \fBpControl\fP"
.br
.RI "\fIUsed by direct show for media \fBcontrol\fP. \fP"
.ti -1c
.RI "ISampleGrabber * \fBpGrabber\fP"
.br
.RI "\fIUsed to grab frames. \fP"
.ti -1c
.RI "HANDLE \fBmImageMutex\fP"
.br
.RI "\fIMutex for thread protection. \fP"
.ti -1c
.RI "volatile bool \fBmStopFlag\fP"
.br
.RI "\fIFlag to stop video capture. \fP"
.ti -1c
.RI "volatile bool \fBmReadyFlag\fP"
.br
.RI "\fIFlag to signal capture is ready. \fP"
.ti -1c
.RI "volatile bool \fBmInterlacedFlag\fP"
.br
.RI "\fIShould we de-interlace the frame? \fP"
.ti -1c
.RI "volatile unsigned int \fBmFrameNumber\fP"
.br
.RI "\fI\fBFrame\fP number. \fP"
.ti -1c
.RI "long \fBmDataSize\fP"
.br
.RI "\fISize of image buffer in bytes. \fP"
.ti -1c
.RI "int \fBmWidth\fP"
.br
.RI "\fIWidth of the image in pixels. \fP"
.ti -1c
.RI "int \fBmHeight\fP"
.br
.RI "\fIHeight of the image in pixels. \fP"
.ti -1c
.RI "int \fBmDesWidth\fP"
.br
.RI "\fIDesired width. \fP"
.ti -1c
.RI "int \fBmDesHeight\fP"
.br
.RI "\fIDesired height. \fP"
.ti -1c
.RI "unsigned char * \fBmpImageBuffer\fP"
.br
.RI "\fIActual image data. \fP"
.ti -1c
.RI "unsigned int \fBmGetFrameNumber\fP"
.br
.RI "\fIThe last frame number retrieved. \fP"
.ti -1c
.RI "double \fBmFrameTimeMs\fP"
.br
.RI "\fITime of frame capture. \fP"
.ti -1c
.RI "std::string \fBmSourceName\fP"
.br
.RI "\fIName of image source. \fP"
.in -1c
.SH "Member Function Documentation"
.PP 
.SS "int DirectShowCapture::GetFrame (\fBCvImageCapture::Image\fP * dest, const bool block = \fCfalse\fP)"
.PP
Get the next frame from the image source. An internal counter is kept that keeps track of what frame number was last retrieved from the image source. This counter prevents you from get the same frame multiple times (over sampling). If you set the blocking flag to false, then if the next frame hasn't arrived yet, the function will return 0.
.PP
\fBParameters:\fP
.RS 4
\fIdest\fP The destination (where to save image to). 
.br
\fIblock\fP If true, then this function will block until the next image arrives, otherwise not.
.RE
.PP
\fBReturns:\fP
.RS 4
1 if image retrieved, otherwise 0. 
.RE
.PP

.SS "HRESULT DirectShowCapture::GetPin (IBaseFilter * pFilter, PIN_DIRECTION dirrequired, int iNum, IPin ** ppPin)\fC [static, protected]\fP"
.PP
Get a pin in the the graph. \fBParameters:\fP
.RS 4
\fIpFilter\fP The filter. 
.br
\fIdirrequired\fP The pin directoin required. 
.br
\fIiNum\fP Input number. 
.br
\fIppPin\fP Pointer to pin.
.RE
.PP
\fBReturns:\fP
.RS 4
Result < 0 is failure, >= 0 is success. 
.RE
.PP

.SS "HRESULT DirectShowCapture::GetVideoInputFilter (IBaseFilter ** gottaFilter, const int num)\fC [static, protected]\fP"
.PP
Enumerate all of the video input devices. \fBParameters:\fP
.RS 4
\fIgottaFilter\fP Input filter pointer. 
.br
\fInum\fP The video device number to get input filter for. This is [0, num video sources].
.RE
.PP
\fBReturns:\fP
.RS 4
The filter with a matching friendly name. 
.RE
.PP

.SS "HRESULT DirectShowCapture::GetVideoInputFilter (IBaseFilter ** gottaFilter, wchar_t * matchName)\fC [static, protected]\fP"
.PP
Enumerate all of the video input devices. \fBParameters:\fP
.RS 4
\fIgottaFilter\fP Input filter pointer. 
.br
\fImatchName\fP The friendly name of the device (camera name) to match to.
.RE
.PP
\fBReturns:\fP
.RS 4
The filter with a matching friendly name. 
.RE
.PP

.SS "int DirectShowCapture::InitializeFile ()\fC [protected]\fP"
.PP
Initializes capture from a file video source. \fBReturns:\fP
.RS 4
1 if success, otherwise 0. 
.RE
.PP

.SS "int DirectShowCapture::InitializeVideo ()\fC [protected]\fP"
.PP
Initializes capture from a video source, (USB or Firewire DV Camera). \fBReturns:\fP
.RS 4
1 if success, otherwise 0. 
.RE
.PP

.SS "unsigned int DirectShowCapture::ScanForSources (std::vector< std::string > & sources)\fC [static]\fP"
.PP
Get a list of video sources connected to the computer (cameras). \fBParameters:\fP
.RS 4
\fIsources\fP Copy of source names.
.RE
.PP
\fBReturns:\fP
.RS 4
The number of video sources connected to the computer. 
.RE
.PP

.SS "int DirectShowCapture::Start (const std::string & videoSource, const int width = \fC0\fP, const int height = \fC0\fP, const bool interlace = \fCfalse\fP)"
.PP
Start capture from a video source. If width or height <= 0 the largest formats upported from the video source is used. Otherwise an attempt to select the size will be tried, and if the desired resolution fails, a default resolution will be used. This \fBfeature\fP may not be supported outside of Windows and does not work with video files (only cameras).
.PP
\fBParameters:\fP
.RS 4
\fIvideoSource\fP The String/Friendly name of the video source. If left blank ( '' ), then the first device on the system will be used. This value is the name of a camera or a video file. You can also use an ascii number representing the device. For example '0' for camera 0, '1' for camera 1, etc. 
.br
\fIwidth\fP Desired image width resolution if supported. If <= 0 then first working resolution is chosen from camera. 
.br
\fIheight\fP Desired image height resolutoin if supported. If <= 0 then first working resolution is chosen from camera. 
.br
\fIiterlace\fP If the video is interlaced, set to true and it will be automatically de-interlaced.
.RE
.PP
\fBReturns:\fP
.RS 4
1 if started, otherwise 0. 
.RE
.PP

.SS "int DirectShowCapture::Stop ()"
.PP
Stops capture from video source. \fBReturns:\fP
.RS 4
1 if stopped, otherwise 0. 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for zebulon from the source code.
